package com.shq.ex1;

import android.os.Bundle;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

import com.shq.ex1.game.HardActivity;
import com.shq.ex1.game.HelpActivity;
import com.shq.ex1.game.PlayActivity;

public class DdsActivity extends Activity {

    private Button easyBtn = null;//简单模式
    private Button hardBtn = null;//困难模式
    private Button helpBtn = null;//帮助
    private Button exit = null;//退出
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_dds);
        easyBtn = (Button) findViewById(R.id.easyBtn);
        hardBtn = (Button) findViewById(R.id.hardBtn);
        helpBtn = (Button) findViewById(R.id.helpBtn);
        exit = (Button) findViewById(R.id.exit);
        easyBtn.setOnClickListener(new OnClickListener() {//简单模式

            @Override
            public void onClick(View v) {
                Intent intent = new Intent();
                intent.setClass(DdsActivity.this, PlayActivity.class);
                DdsActivity.this.startActivity(intent);
            }
        });
        hardBtn.setOnClickListener(new OnClickListener() {//困难模式

            @Override
            public void onClick(View arg0) {
                Intent intent = new Intent();
                intent.setClass(DdsActivity.this, HardActivity.class);
                DdsActivity.this.startActivity(intent);
            }
        });
        helpBtn.setOnClickListener(new OnClickListener() {//帮助

            @Override
            public void onClick(View v) {
                Intent intent = new Intent();
                intent.setClass(DdsActivity.this, HelpActivity.class);
                DdsActivity.this.startActivity(intent);
            }
        });
        exit.setOnClickListener(new OnClickListener() {//退出

            @Override
            public void onClick(View v) {
                new AlertDialog.Builder(DdsActivity.this).setTitle("提示").setMessage("是否退出?").setNeutralButton("取消", null).
                        setNegativeButton("确定", new DialogInterface.OnClickListener() {

                            @Override
                            public void onClick(DialogInterface dialog, int which) {
                                DdsActivity.this.finish();
                            }
                        }).create().show();
            }
        });
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }
}
